const formatTime = date => {
    const year = date.getFullYear()
    const month = date.getMonth() + 1
    const day = date.getDate()
    const hour = date.getHours()
    const minute = date.getMinutes()
    const second = date.getSeconds()

    return [year, month, day].map(formatNumber).join('/') + ' ' + [hour, minute, second].map(formatNumber).join(':')
}


const formatNumber = n => {
    n = n.toString()
    return n[1] ? n : '0' + n
}


//图片基路径
const picBasePath = 'http://beta.juboon.com:8145/upload/appletImage/'
    //请求域名
    const url = "https://beta.bndxqc.com/gp"

//不通过路由直接获取url中多个参数的方法
const getUrlKey= name => {  
    return decodeURIComponent((new RegExp('[?|&]' + name + '=' + '([^&;]+?)(&|#|;|$)').exec(location.href) || [, ""])[1].replace(/\+/g, '%20')) || null
}
 

export default {
    formatTime: formatTime,
    picBasePath: picBasePath,
    url: url,
    getUrlKey:getUrlKey
}